# Copyright 2024 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_python//python:packaging.bzl", "py_package", "py_wheel")
load("//:defs.bzl", "py_versions_select")
load("//:version.bzl", "DATAPROXY_SDK_VERSION")

package(default_visibility = ["//visibility:public"])

py_library(
    name = "dataproxy_sdk_py",
    deps = [
        "//dataproxy:dataproxy_sdk_init",
    ],
)

py_package(
    name = "dataproxy_sdk_pkg",
    packages = [
        "dataproxy",
    ],
    visibility = ["//visibility:private"],
    deps = [
        ":dataproxy_sdk_py",
    ],
)

python_version_select = py_versions_select(
    "whl_python_version",
    {
        "3.10": "cp310",
        "3.11": "cp311",
        "3.9": "cp39",
    },
    default = "none",
)

py_wheel(
    name = "dataproxy_sdk_whl",
    abi = python_version_select,
    author = "SecretFlow Team",
    author_email = "secretflow-contact@service.alipay.com",
    classifiers = [
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "Programming Language :: Python :: 3.11",
    ],
    distribution = "secretflow-dataproxy",
    homepage = "https://github.com/secretflow/dataproxy",
    license = "Apache License 2.0",
    # TODO: add other fields.
    platform = select(
        {
            "@bazel_tools//src/conditions:linux_x86_64": "manylinux2014_x86_64",
            "@bazel_tools//src/conditions:darwin_arm64": "macosx_12_0_arm64",
            "@bazel_tools//src/conditions:linux_aarch64": "manylinux_2_28_aarch64",
            "//conditions:default": "any",
        },
    ),
    python_requires = ">=3.9, <3.12",
    python_tag = python_version_select,
    requires_file = "requirements.txt",
    tags = ["manual"],
    twine = None,
    version = DATAPROXY_SDK_VERSION,
    deps = [
        ":dataproxy_sdk_pkg",
    ],
)
